package com.irdstudio.bhcredit.console.web;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.irdstudio.bhcredit.console.service.api.PluginServiceParamService;
import com.irdstudio.bhcredit.console.service.vo.PluginServiceParamVO;
import com.irdstudio.ssm.framework.constant.ResponseData;
import com.irdstudio.ssm.framework.web.AbstractController;

@RestController
@RequestMapping("/api")
public class PluginServiceParamController extends AbstractController  {
	
	@Autowired
	@Qualifier("pluginServiceParamServiceImpl")
	private PluginServiceParamService pluginServiceParamService;

	
	/**
	 * 列表数据查询
	 * @param page
	 * @param size
	 * @return
	 */
	@RequestMapping(value="/plugin/service/params", method=RequestMethod.POST)
	public @ResponseBody ResponseData<List<PluginServiceParamVO>> queryPluginServiceParamAll(
			PluginServiceParamVO vo) {		
		List<PluginServiceParamVO> outputVo = pluginServiceParamService.queryAllOwner(vo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键查询详情
	 * @return
	 */
	@RequestMapping(value="/plugin/service/param/{paramGroupId}/{serviceParamName}", method=RequestMethod.GET)
	public @ResponseBody ResponseData<PluginServiceParamVO> queryByPk(@PathVariable("paramGroupId") String paramGroupId,@PathVariable("serviceParamName") String serviceParamName) {		
		PluginServiceParamVO inVo = new PluginServiceParamVO();
				inVo.setParamGroupId(paramGroupId);
				inVo.setServiceParamName(serviceParamName);
		PluginServiceParamVO outputVo = pluginServiceParamService.queryByPk(inVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键删除信息
	 * @param pluginServiceParam
	 * @return
	 */
	@RequestMapping(value="/plugin/service/param", method=RequestMethod.DELETE)
	public @ResponseBody ResponseData<Integer> deleteByPk(@RequestBody PluginServiceParamVO inPluginServiceParamVo) {		
		int outputVo = pluginServiceParamService.deleteByPk(inPluginServiceParamVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 根据主键更新信息
	 * @param inPluginServiceParamVo
	 * @return
	 */
	@RequestMapping(value="/plugin/service/param", method=RequestMethod.PUT)
	public @ResponseBody ResponseData<Integer> updateByPk(@RequestBody PluginServiceParamVO inPluginServiceParamVo) {		
		int outputVo = pluginServiceParamService.updateByPk(inPluginServiceParamVo);
		return getResponseData(outputVo);
		
	}
	
	/**
	 * 新增数据
	 * @param inPluginServiceParamVo
	 * @return
	 */
	@RequestMapping(value="/plugin/service/param", method=RequestMethod.POST)
	public @ResponseBody ResponseData<Integer> insertPluginServiceParam(@RequestBody PluginServiceParamVO inPluginServiceParamVo) {
		int outputVo = pluginServiceParamService.insertPluginServiceParam(inPluginServiceParamVo);
		return getResponseData(outputVo);
		
	}
}
